package com.beta.em.admins;

import java.util.Objects;

/**
 * Created by lichao on 2017/1/3.
 */
public enum AdminRolesType {

    SUPER("super", "平台管理员"),
    OPERATOR("operator", "城市超管"),
    CASHIER("cashier", "城市出纳"),
    ACCOUNTANT("accountant", "城市会计"),
    CITY_MANAGER("city_manager", "城市经理"),
    SUPER_ACCOUNTANT("super_accountant", "总部财务");

    public final String value;
    public final String cnValue;

    AdminRolesType(String value, String cnValue) {
        this.value = value;
        this.cnValue = cnValue;
    }

    public static AdminRolesType getAdminRolesType(String value) {
        for (AdminRolesType adminRolesType : values()) {
            if (adminRolesType.value.equals(value)) {
                return adminRolesType;
            }
        }
        return null;
    }

    public static String getCnValue(String value) {
        AdminRolesType adminRolesType = getAdminRolesType(value);
        if (Objects.nonNull(adminRolesType)) {
            return adminRolesType.cnValue;
        }
        return "";
    }
}
